package com.size.mall.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.size.mall.mallapi.entity.PmsSkuImage;
import com.size.mall.mallapi.service.PmsSkuImageService;
import com.size.mall.mapper.PmsSkuImageMapper;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@Service
public class PmsSkuImageServiceImpl extends ServiceImpl<PmsSkuImageMapper, PmsSkuImage> implements
        PmsSkuImageService {
    //
    // @Autowired
    // RedissonClient redissonClient;


    @Override
    @Cacheable(value = "img", unless = "#result==null")
    public List<PmsSkuImage> getImags(String skuId) {

        // RLock moneyLock = redissonClient.getLock("money");

        // moneyLock.delete();


        List<PmsSkuImage> imageList = (List<PmsSkuImage>)
                this.list(new QueryWrapper<PmsSkuImage>()
                                  .eq("sku_id", skuId));
        return imageList;
    }


}
